package com.liucxu.qiushimeinv.Presenter.Impl;

import com.liucxu.qiushimeinv.Model.Bean.BaseBean;
import com.liucxu.qiushimeinv.Model.IPayFeedbackModel;
import com.liucxu.qiushimeinv.Model.Impl.PayFeedbackModelImpl;
import com.liucxu.qiushimeinv.Presenter.IPayFeedbackPresenter;
import com.liucxu.qiushimeinv.Utils.CommonSubscriber;
import com.liucxu.qiushimeinv.Utils.TransformUtils;
import com.liucxu.qiushimeinv.View.IView.IPayFeedbackView;

/**
 * 用户转账账号信息
 * Created by liukanshan on 2017/1/5.
 */

public class PayFeedbackPresenterImpl implements IPayFeedbackPresenter {

    private IPayFeedbackView payView;
    private IPayFeedbackModel model;

    public PayFeedbackPresenterImpl(IPayFeedbackView view) {
        if (view != null) {
            payView = view;
            model=new PayFeedbackModelImpl();
        }
    }

    @Override
    public void submitUserCountInfo(String pay_count) {
        model.payFeedback(pay_count).compose(TransformUtils.<BaseBean>defaultScheduler()).subscribe(new CommonSubscriber<BaseBean>() {
            @Override
            public void onSuccess(BaseBean response) {
                payView.feedbackSuccess();
            }

            @Override
            public void onFailure(BaseBean response) {
                payView.showError(response);
            }
        });
    }
}
